SRC_DIR=./src
GMP_DIR=/homes/ndcao/courses/cs555/gmp-4.3.2
GMP_LIB_DIR=./homes/ndcao/courses/cs555/gmp

STATIC_LIBS = -L${GMP_LIB_DIR} -lgmp

INCLUDE_DIR = -I${SRC_DIR} -I${GMP_DIR}

CC = gcc

## all objects
ALL_OBJ = xcun.o utils.o mplib.o
ALL_OBJS = ${SRC_DIR}/xcun.o ${SRC_DIR}/utils.o ${SRC_DIR}/mplib.o

### for debugging ###
CFLAGS = -Wall -O0 -g -DNDEBUG

CXXFLAGS =	-O2 -g -Wall -fmessage-length=0

TARGET = xcun
TARGET_SRC = ${SRC_DIR}/xcun.c

utils.o: 
	${CC} ${CFLAGS} -o ${SRC_DIR}/utils.o ${INCLUDE_DIR} ${STATIC_LIBS} -c ${SRC_DIR}/utils.c
	
mplib.o: utils.o
	${CC} ${CFLAGS} -o ${SRC_DIR}/mplib.o ${INCLUDE_DIR} ${STATIC_LIBS} -c ${SRC_DIR}/mplib.c

xcun.o: mplib.o utils.o
	${CC} ${CFLAGS} -o ${SRC_DIR}/xcun.o ${INCLUDE_DIR} ${STATIC_LIBS} -c ${SRC_DIR}/xcun.c

${TARGET}: ${ALL_OBJ}
	${CC} ${CFLAGS} -o ${TARGET} ${INCLUDE_DIR} ${STATIC_LIBS} ${ALL_OBJS}

all:	 ${TARGET}

clean:
	rm -f *.o ${TARGET};
	rm -f ${ALL_OBJS}


